package cn.edu.ptu.jobfairs.basic.enums;

/**
 * @author wutingting.226@163.com
 * @date 2020/9/5
 */

public enum SignStatus {
    //0提交 1待签约 -1拒绝签约 2已签约 -2对方拒绝签约
    SUBMIT(0, "提交"),
    TO_BE_SIGNED(1, "待签约"),
    REFUSE_TO_SIGN(-1, "拒绝签约"),
    SIGNED(2, "已签约"),
    CANDICATE_REFUSED(-2, "对方拒绝签约");

    private int value;

    SignStatus(int value, String desc) {
        this.value = value;
    }

    public static String nameOf(Integer value) {
        if (value == null) return "unknown";
        for(SignStatus signStatus: values()) {
            if (signStatus.value == value) {
                return signStatus.name().toLowerCase();
            }
        }
        return "unknown";
    }

    public static boolean exists(Integer value) {
        if (value == null) return false;
        for(SignStatus signStatus: values()) {
            if (signStatus.value == value) {
                return true;
            }
        }
        return false;
    }
}
